import QtQuick 2.11

import "."
import "_Global"
import "_Global/Button"

import "_Global/Global.js" as GlobalJS
import "GameJS.js" as GameJS

Item {
    signal s_close()

    id: root
    visible: true
    anchors.fill: parent

    function refreshInfo() {
        textUserName.text = qsTr("用户名：") + UserInfo.userName;
        textSex.text = qsTr("性别：") + (UserInfo.sex == 1 ? qsTr("男") : qsTr("女"));

        textServer.text = qsTr("服务器：") + UserInfo.serverName + "-" + UserInfo.gradeName;
        textGameUserName.text = qsTr("游戏名：") + GameManager.userInfo.nickName;
        textUserLevel.text = qsTr("学习等级：") + Global.userInfo.userLevelName;
        textTotalScore.text = qsTr("总积分：") + GameManager.userInfo.scoreCount;
        textScoreYesterday.text = qsTr("昨日积分：") + GameManager.userInfo.scoreYesterday;
        textScoreWeek.text = qsTr("一周积分：") + GameManager.userInfo.scoreWeek;
        //info.text = "\n购买记录：" + (GameManager.userInfo.flagCorrectAnswer) + (GameManager.userInfo.canReview);
        //console.debug("UserInfo.gameServerInfoMap")
        //console.debug(UserInfo.gameServerInfoMap["1"])
    }

    Rectangle {
        id: background
        color: "#00ffffff"
        anchors.rightMargin: 0
        anchors.bottomMargin: 0
        anchors.leftMargin: 0
        anchors.topMargin: 0
        anchors.fill: parent

        MouseArea { //防穿透
            anchors.fill: parent
        }

        Image {
            id: imageBack
            source: (UserInfo.sex == 1) ? Global._FixResourcePath_R("Media/Images/Center/UserInfo/Boy.png")
                                        : Global._FixResourcePath_R("Media/Images/Center/UserInfo/Girl.png")
            anchors.centerIn: parent
            anchors.fill: parent

            Text {
                id: textUserName
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize1
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectUserName.x
                y: Global.gamePos.mapGameUserInfo.rectUserName.y
                width: Global.gamePos.mapGameUserInfo.rectUserName.width
                height: Global.gamePos.mapGameUserInfo.rectUserName.height

                elide: Text.ElideRight
            }

            Text {
                id: textSex
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize1
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectSex.x
                y: Global.gamePos.mapGameUserInfo.rectSex.y
                width: Global.gamePos.mapGameUserInfo.rectSex.width
                height: Global.gamePos.mapGameUserInfo.rectSex.height

                elide: Text.ElideRight
            }

            Text {
                id: textServer
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize1
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectServer.x
                y: Global.gamePos.mapGameUserInfo.rectServer.y
                width: Global.gamePos.mapGameUserInfo.rectServer.width
                height: Global.gamePos.mapGameUserInfo.rectServer.height

                elide: Text.ElideRight
            }

            Text {
                id: textGameUserName
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize1
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectGameUserName.x
                y: Global.gamePos.mapGameUserInfo.rectGameUserName.y
                width: Global.gamePos.mapGameUserInfo.rectGameUserName.width
                height: Global.gamePos.mapGameUserInfo.rectGameUserName.height

                elide: Text.ElideRight
            }

            Text {
                id: textUserLevel
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize1
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectUserLevel.x
                y: Global.gamePos.mapGameUserInfo.rectUserLevel.y
                width: Global.gamePos.mapGameUserInfo.rectUserLevel.width
                height: Global.gamePos.mapGameUserInfo.rectUserLevel.height

                elide: Text.ElideRight
            }

            Text {
                id: textTotalScore
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize2
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectTotalScore.x
                y: Global.gamePos.mapGameUserInfo.rectTotalScore.y
                width: Global.gamePos.mapGameUserInfo.rectTotalScore.width
                height: Global.gamePos.mapGameUserInfo.rectTotalScore.height

                elide: Text.ElideRight
            }

            Text {
                id: textScoreYesterday
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize2
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectScoreYesterday.x
                y: Global.gamePos.mapGameUserInfo.rectScoreYesterday.y
                width: Global.gamePos.mapGameUserInfo.rectScoreYesterday.width
                height: Global.gamePos.mapGameUserInfo.rectScoreYesterday.height

                elide: Text.ElideRight
            }

            Text {
                id: textScoreWeek
                text: qsTr("")
                font {
                    //family: ""
                    pixelSize: Global.gamePos.mapGameUserInfo.nFontSize2
                    //bold: true
                }
                color: "white"
                x: Global.gamePos.mapGameUserInfo.rectScoreWeek.x
                y: Global.gamePos.mapGameUserInfo.rectScoreWeek.y
                width: Global.gamePos.mapGameUserInfo.rectScoreWeek.width
                height: Global.gamePos.mapGameUserInfo.rectScoreWeek.height

                elide: Text.ElideRight
            }

            ImageButton2 {
                id: buttonClose        //关闭
                x: Global.gamePos.mapGameUserInfo.rectClose.x
                y: Global.gamePos.mapGameUserInfo.rectClose.y
                width: Global.gamePos.mapGameUserInfo.rectClose.width
                height: Global.gamePos.mapGameUserInfo.rectClose.height

                source: Global._FixResourcePath_R("Media/Images/Class/ClassInfo/Close.png")

                soundEffectClick: Global.resource.effects.effectClose
                bEffectOn: Global.config.bEffectOn


                onButtonClicked: {
                    s_close()
                }
            }
        }
    }


    Component.onCompleted: {
    }

}
